﻿/* PN264 - A Parallel H.264 Encoding Utility
 * Copyright © 2009 PN264 Development Team
 *
 * This software is released under the terms and conditions of the MIT License,
 * a copy of which can be found in the License.txt file.
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace PN264.Net
{
    /// <summary>
    /// Represents a message transmitted between two PN264 peers.
    /// </summary>
    [StructLayout(LayoutKind.Explicit)]
    public sealed class Message
    {
        #region Constructors
        internal Message()
        {
        }
        #endregion
        #region Fields
        [FieldOffset(0x0)]
        private MessageType type;
        [FieldOffset(0x1)]
        private ushort id;
        [FieldOffset(0x3)]
        private MessageCommand command;
        [FieldOffset(0x4)]
        private MessageFlags flags;
        [FieldOffset(0x5)]
        private ushort dataSize;
        [FieldOffset(0x7)]
        private byte[] data;
        #endregion
        #region Properties
        public MessageType Type
        {
            get
            {
                return type;
            }
            set
            {
                type = value;
            }
        }
        public ushort Id
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
            }
        }
        public MessageCommand Command
        {
            get
            {
                return command;
            }
            set
            {
                command = value;
            }
        }
        public MessageFlags Flags
        {
            get
            {
                return flags;
            }
            set
            {
                flags = value;
            }
        }
        public ushort DataSize
        {
            get
            {
                return dataSize;
            }
            set
            {
                dataSize = value;
            }
        }
        #endregion
    }
}
